bugfix/main_selection#114
Conversation
This commit updates the Compose compiler configuration and makes minor adjustments to the build scripts.
- In `instuctions`:
- Added `./gradlew --rerun-tasks assembleFossReliantDebug -PenableComposeCompilerMetrics=true -PenableComposeCompilerReports=true` command.
- In `build-logic/convention/src/main/kotlin/com/mshdabiola/app/AndroidCompose.kt`:
- Commented out one of the lines that added `compose_compiler_config.conf` to `stabilityConfigurationFiles`.
- In `compose_compiler_config.conf`:
- Replaced `com.mshdabiola.modules.model.data.*` with `com.mshdabiola.model.*`.
- Added `kotlin.collections.*` to the list of stable classes.
…d.selected`
This commit refactors how item selection is managed in the main feature. It replaces the `selected` boolean property in the `NotePad` model with a `setOfSelected` (a `Set<Long>`) in `MainState.Success`. This set stores the IDs of the selected items.
**Key changes:**
- **`feature/main/MainState.kt`**:
- Added `setOfSelected: Set<Long> = emptySet()` to `MainState.Success` to track selected item IDs.
- **`feature/main/MainScreen.kt`**:
- Updated logic for `navigateToSelectLevel` to use `(mainState.value as MainState.Success).setOfSelected`.
- Modified `noOfSelected` to be derived from `success.setOfSelected.size`.
- Updated `isAllPin` to filter `notePads` based on whether their IDs are contained in `success.setOfSelected`.
- The `LazyVerticalStaggeredGrid` items now receive the `setOfSelected` and pass the selection status to `NoteCard` via a new `isSelect` parameter.
- **`feature/main/MainViewModel.kt`**:
- `onSelectCard(id: Long)`: Now updates `_mainState.value` by adding or removing the `id` from the `setOfSelected` in `MainState.Success`.
- `clearSelected()`: Resets `setOfSelected` to an empty set in `MainState.Success`.
- Functions like `setPin()`, `setAlarm()`, `deleteAlarm()`, `setAllColor()`, `setAllArchive()`, and `setAllDelete()` now use the `setOfSelected` from `getSuccess()` to determine which notes to operate on.
- `copyNote()`: Now retrieves the ID of the note to copy from `getSuccess().setOfSelected.first()`.
- **`feature/main/TopbarAndDialog.kt`**:
- `NoteCard` composable:
- Added a new `isSelect: Boolean = false` parameter.
- The border of the card is now determined by the `isSelect` parameter instead of `notePad.selected`.
- Removed `selected = true` from the `NoteCardPreview`.
- **`modules/model/NotePad.kt`**:
- Removed the `selected: Boolean` property from the `NotePad` data class.
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
|
/improve --pr_code_suggestions.commitable_code_suggestions=true |
This commit renames the function `setAllDelete` to `setAllToTrash` in `MainViewModel.kt` for clarity.
- In `MainViewModel.kt`:
- Renamed `setAllDelete()` to `setAllToTrash()`.
- In `MainScreen.kt`:
- Updated the call from `mainViewModel::setAllDelete` to `mainViewModel::setAllToTrash` in the `onDelete` lambda.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #114 +/- ##
==========================================
- Coverage 0.88% 0.88% -0.01%
==========================================
Files 156 156
Lines 6868 6871 +3
Branches 540 541 +1
==========================================
Hits 61 61
- Misses 6794 6797 +3
Partials 13 13 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
PR Type
Enhancement, Bug fix
Description
Refactored item selection in main feature.
Updated Compose compiler configuration.
Improved build scripts.
Replaced boolean selection with Set.
Changes walkthrough 📝
2 files
Updated Android Compose configurationUpdated Compose compiler configuration5 files
Updated MainScreen to use Set for selectionAdded setOfSelected to MainState.SuccessUpdated MainViewModel to use Set for selectionUpdated NoteCard to handle selection stateAdded gradle command for compose compiler metrics and reports1 files
Removed selected property from NotePad